Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 571e7d7105a2da2a6e3105fad488489a7226aac8


Parents : 2604b44
Author : Mark Qvist <mark@unsigned.io>
Date : 2024-12-31T14:13:52+01:00

Added display reconditioning function

Changes

4 files changed, 42 insertions(+), 7 deletions(-)

M Display.h +25 -3
M Framing.h +1
M Makefile +2 -2

Diff

diff --git a/Display.h b/Display.h
index 903d84e..98e8920 100644
--- a/Display.h
+++ b/Display.h
@@ -99,6 +99,7 @@ uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
uint8_t display_unblank_intensity = display_intensity;
bool display_blanked = false;
bool display_tx = false;
+bool recondition_display = false;
uint8_t disp_target_fps = 7;
int disp_update_interval = 1000/disp_target_fps;
uint32_t last_page_flip = 0;
@@ -707,6 +708,21 @@ void update_disp_area() {
}
}
+void display_recondition() {
+ for (uint8_t iy = 0; iy < disp_area.height(); iy++) {
+ unsigned char rand_seg [] = {random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF)};
+ stat_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
+ disp_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
+ }
+
+ display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+ if (disp_mode == DISP_MODE_PORTRAIT) {
+ display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+ } else if (disp_mode == DISP_MODE_LANDSCAPE) {
+ display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
+ }
+}
+
void update_display(bool blank = false) {
if (blank == true) {
last_disp_update = millis()-disp_update_interval-1;
@@ -754,9 +770,15 @@ void update_display(bool blank = false) {
display.clearDisplay();
#endif
- update_stat_area();
- update_disp_area();
-
+ if (recondition_display) {
+ disp_target_fps = 30;
+ disp_update_interval = 1000/disp_target_fps;
+ display_recondition();
+ } else {
+ update_stat_area();
+ update_disp_area();
+ }
+
#if BOARD_MODEL != BOARD_TDECK
display.display();
#endif

diff --git a/Framing.h b/Framing.h
index 37065b7..d31af63 100644
--- a/Framing.h
+++ b/Framing.h
@@ -57,6 +57,7 @@
#define CMD_DISP_ADDR 0x63
#define CMD_DISP_BLNK 0x64
#define CMD_DISP_ROT 0x67
+ #define CMD_DISP_RCND 0x68
#define CMD_NP_INT 0x65
#define CMD_BT_CTRL 0x46
#define CMD_BT_PIN 0x62

diff --git a/Makefile b/Makefile
index 0d0fb51..3a18634 100644
--- a/Makefile
+++ b/Makefile
@@ -181,8 +181,8 @@ upload-heltec32_v3:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:heltec_wifi_lora_32_V3
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware.ino.bin)
- @sleep 3
- python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
+ #@sleep 3
+ #python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-tdeck:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3

diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino
index 924bf34..f890cde 100644
--- a/RNode_Firmware.ino
+++ b/RNode_Firmware.ino
@@ -1098,7 +1098,6 @@ void serialCallback(uint8_t sbyte) {
db_conf_save(sbyte);
display_unblank();
}
-
#endif
} else if (command == CMD_DISP_ROT) {
#if HAS_DISPLAY
@@ -1113,7 +1112,20 @@ void serialCallback(uint8_t sbyte) {
drot_conf_save(sbyte);
display_unblank();
}
-
+ #endif
+ } else if (command == CMD_DISP_RCND) {
+ #if HAS_DISPLAY
+ if (sbyte == FESC) {
+ ESCAPE = true;
+ } else {
+ if (ESCAPE) {
+ if (sbyte == TFEND) sbyte = FEND;
+ if (sbyte == TFESC) sbyte = FESC;
+ ESCAPE = false;
+ }
+ if (sbyte > 0x00) recondition_display = true;
+ display_unblank();
+ }
#endif
} else if (command == CMD_NP_INT) {
#if HAS_NP


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────